package school.valon.persistence.pojo;

import java.io.Serializable;

import javax.persistence.*;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the payment database table.
 * 
 */
@Entity
@Table(name="payment")
@NamedQueries({
@NamedQuery(name="Payment.findAll", query="SELECT p FROM Payment p"),
@NamedQuery(name="Payment.deleteById", query="DELETE FROM Payment WHERE paymentId = :P1")
})
public class Payment implements Serializable {

	private static final long serialVersionUID = -8804537026154190096L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="payment_id")
	private Integer paymentId;

	@Column
	private BigDecimal amount;

	@Temporal(TemporalType.DATE)
	@Column(name="paid_on")
	private Date paidOn;

	//bi-directional many-to-one association to ExpensePayment
	@OneToMany(mappedBy="payment", fetch=FetchType.LAZY)
	private List<ExpensePayment> expensePayments;

	//bi-directional many-to-one association to PaymentType
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="payment_type_id")
	private PaymentType paymentType;

	//bi-directional many-to-one association to User
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="paid_by_user_id")
	private User user;

	public Integer getPaymentId() {
		return this.paymentId;
	}

	public void setPaymentId(Integer paymentId) {
		this.paymentId = paymentId;
	}

	public BigDecimal getAmount() {
		return this.amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public Date getPaidOn() {
		return this.paidOn;
	}

	public void setPaidOn(Date paidOn) {
		this.paidOn = paidOn;
	}

	public List<ExpensePayment> getExpensePayments() {
		return this.expensePayments;
	}

	public void setExpensePayments(List<ExpensePayment> expensePayments) {
		this.expensePayments = expensePayments;
	}

	public PaymentType getPaymentType() {
		return this.paymentType;
	}

	public void setPaymentType(PaymentType paymentType) {
		this.paymentType = paymentType;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}